<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class FyRegion extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('fy_region', function (Blueprint $table) {
            $table->id();
//            $table->string('provinceCode', 12)->default("")->comment('省份code');
//            $table->string('cityCode', 12)->default("")->comment('市级code');
//            $table->string('districtCode', 12)->default("")->comment('区域code');

            $table->string('code', 12)->default("")->comment('code');
            $table->string('pCode', 12)->default("")->comment('pCode');
            $table->string('name', 36)->default("")->comment('名称');
            $table->string('regionBankCode', 12)->default("")->comment('城市银行code');
            $table->unsignedTinyInteger('level')->default(0)->comment('等级');


            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment = '富有 - 省市区';

            $table->unique(["code", "level"], "idx_code_level");
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('fy_region');
    }
}
